<template>
	<div class="choose">
		<el-radio-group v-model="isCollapse" style="margin-bottom: 0px;width: 100%;">
			<el-radio-button :label="false">展开</el-radio-button>
			<el-radio-button :label="true">收起</el-radio-button>
		</el-radio-group>
		<el-menu default-active="1-4-1" class="el-menu-vertical-demo" unique-opened router @open="handleOpen" @close="handleClose"
			:collapse="isCollapse">
			<el-submenu v-for="menu in menus" :index="''+menu.permissionId+''">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">{{menu.name}}</span>
				</template>
				<ChilrenMenu v-for="item in menu.children" :menu="item"></ChilrenMenu>
			</el-submenu>
			<!-- 菜单模板
			<el-submenu index="1">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">床位管理</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/bed">床位管理图</el-menu-item>
					<el-menu-item index="/bed_record">床位管理</el-menu-item>
				</el-menu-item-group>
			</el-submenu>
			<el-submenu index="2">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">健康档案</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/health_file">健康档案</el-menu-item>
					<el-menu-item index="/case_history">就诊/询诊记录</el-menu-item>
				</el-menu-item-group>
			</el-submenu>
			<el-submenu index="3">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">康复管理</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/kf_register">康复登记</el-menu-item>
					<el-menu-item index="/kf_program">康复计划</el-menu-item>
					<el-menu-item index="/kf_record">康复跟踪</el-menu-item>
				</el-menu-item-group>
			</el-submenu>
			<el-submenu index="4">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">客户管理</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/register">入住登记</el-menu-item>
					<el-menu-item index="/user">客户信息</el-menu-item>
					<el-menu-item index="/exit_registration">退住登记</el-menu-item>
					<el-menu-item index="/go_to_register">外出登记</el-menu-item>
				</el-menu-item-group>
			</el-submenu>

			<el-submenu index="5">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">膳食管理</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/meals_menology">膳食日历</el-menu-item>
					<el-menu-item index="/meals">膳食管理</el-menu-item>
				</el-menu-item-group>
			</el-submenu>

			<el-submenu index="6">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">护理管理</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/nurse_class">护理级别</el-menu-item>
					<el-menu-item index="/n_content">护理内容</el-menu-item>
					<el-menu-item index="/nurse_record">护理记录</el-menu-item>
				</el-menu-item-group>
			</el-submenu>

			<el-submenu index="7">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">健康管家</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/service_object">设置服务对象</el-menu-item>
					<el-menu-item index="/services_focus">服务关注</el-menu-item>
					<el-menu-item index="/daily_care">日常生活照料</el-menu-item>
					<el-menu-item index="/emergency_management">紧急事件处理</el-menu-item>
				</el-menu-item-group>
			</el-submenu>

			<el-submenu index="8">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">护理站</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/work_diary">工作日志</el-menu-item>
				</el-menu-item-group>
			</el-submenu>

			<el-submenu index="9">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">系统设置</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/staff_management">工作人员管理</el-menu-item>
					<el-menu-item index="/life_plan">日常生活照料方案</el-menu-item>
				</el-menu-item-group>
			</el-submenu>
			
			<el-submenu index="10">
				<template slot="title">
					<i class="el-icon-location"></i>
					<span slot="title">登录用户设置</span>
				</template>
				<el-menu-item-group>
					<el-menu-item index="/louser">用户管理</el-menu-item>
					<el-menu-item index="/lorole">角色管理</el-menu-item>
					<el-menu-item index="/lomenu">菜单管理</el-menu-item>
				</el-menu-item-group>
			</el-submenu> -->

		</el-menu>
	</div>
</template>

<script>
	import ChilrenMenu from '@/components/childrenMenu'
	export default {
		name: "Menu",
		data() {
			return {
				isCollapse: false,
				menus: []
			}
		},
		methods: {
			handleOpen(key, keyPath) {
				
			},
			handleClose(key, keyPath) {
				
			}
		},
		components: {
			ChilrenMenu
		},
		created() {
			this.axios.post('/permission/userPermissionList', response => {
				this.menus = response.obj
			})
		}
	}
</script>

<style scoped>
	body {
		color: wheat;
	}

	.choose {
		background-color: white;
		
	}

	.el-menu-vertical-demo:not(.el-menu--collapse) {
		width: 10o%;
		min-height: 400px;
	}
</style>
